#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> result;
        for (int i = 1; i <= numRows; i++) {
            vector<int> V;

            if (result.size() == 0) {
                V.push_back(1);
            }
            else {
                int size = (*(result.end()-1)).size();
                V.push_back(1);
                for (int i = 0; i < size - 1; i++) {
                    V.push_back((*(result.end()-1))[i] + (*(result.end()-1))[i + 1]);
                }
                V.push_back(1);
            }
            result.push_back(V);
        }
        return result;
    }
};
//
//int main() {
//    Solution S;
//    vector<vector<int>> T = S.generate(5);
//    //vector<vector<int>> V = { {1,2,3},{2,3,4} };
//    return 0;
//}



